<template>
  <base-breadcrumb :breadcrumb="!isAudit">
    <a-card :bordered="false">
      <title-name title="停缓建信息" />

      <a-row :gutter="24">
        <a-col :md="8" :sm="8">
          <a-form-item label="所属单位" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }" :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
            <BaseInput v-model="dels.viewName" disabled />
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="8">
          <a-form-item label="当前形象进度" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }" :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
            <BaseInput v-model="dels.imageProgress" disabled />
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="8">
          <a-form-item label="类型" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }" :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
            <BaseInput v-model="dels._stoppageTypeText" disabled />
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="8" v-if="dels.stoppageType == 'SLOW'">
          <a-form-item label="是否经过董常会" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }" :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
            <BaseInput v-model="dels.ifDongChang" disabled />
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="8">
          <a-form-item label="停缓建/停工原因" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }" :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
            <BaseInput v-model="dels.stopReason.name" disabled />
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="8">
          <a-form-item label="停缓建/停工时间" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }" :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
            <BaseInput v-model="dels.stopDate" disabled />
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="8">
          <a-form-item label="预计复工时间" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }" :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
            <BaseInput v-model="dels.resumeWorkDate" disabled />
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="8">
          <a-form-item label="创建人" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }" :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
            <BaseInput v-model="dels.creatorName" disabled />
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="8">
          <a-form-item label="创建时间" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }" :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
            <BaseInput v-model="dels.createTime" disabled />
          </a-form-item>
        </a-col>
        <a-col :md="24" :sm="24">
          <a-form-item label="情况说明" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }" :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
            <BaseInput v-model="dels.situationComment" type="textarea" disabled />
          </a-form-item>
        </a-col>
      </a-row>
      <title-name title="附件信息" />
      <u-table :list-url="listUrl" :upload-arrys="uploadArrys0" :req-method="reqMethod" :is-upload="false" :upload-list="uploadList" :is-show="false" />
    </a-card>

    <a-card v-if="dels.resumeWorkApply" :bordered="false">
      <title-name title="复工信息" />
      <a-row :gutter="24">
        <a-col :md="8" :sm="8">
          <a-form-item label="实际复工时间" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }" :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
            <BaseInput v-model="dels.resumeWorkApply.createTime" disabled />
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="8">
          <a-form-item label="申请人" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }" :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
            <BaseInput v-model="dels.resumeWorkApply.creatorName" disabled />
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="8">
          <a-form-item label="申请时间" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }" :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
            <BaseInput v-model="dels.resumeWorkApply.createTime" disabled />
          </a-form-item>
        </a-col>
      </a-row>
      <a-row :gutter="24">
        <a-col :md="24" :sm="24">
          <a-form-item label="情况说明" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }" :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
            <BaseInput v-model="dels.resumeWorkApply.situationComment" type="textarea" disabled />
          </a-form-item>
        </a-col>
      </a-row>
      <u-table :list-url="listUrls" :upload-arrys="uploadArrys1" :req-method="reqMethod" :is-upload="false" :upload-list="uploadList" :is-show="false" />
    </a-card>

    <div v-if="!isConsultation" class="page-btn-right-top">
      <!-- <div style="float:right;"> -->
      <a-button type="primary" @click="goBack">
        关闭
      </a-button>
    </div>
  </base-breadcrumb>
</template>

<script>
import Vue from 'vue'
import { STable, Ellipsis } from '@/components'
import { getProjectStopWorkDetails } from '@/api/project/stopWork'
import { workStoppageApplyDetail } from '@/api/project/stopConstruction'

import ARow from 'ant-design-vue/es/grid/Row'
import { indexOf } from 'store/storages/all'

const columns = [
  {
    title: '序号',
    width: 65,
    scopedSlots: { customRender: 'serial' }
  },
  {
    title: '附件名称',
    dataIndex: ' fileName'
  },
  {
    title: '附件格式',
    dataIndex: 'suffixName'
  },
  {
    title: '操作',
    dataIndex: 'action'
  }
]
const columnWbs = [
  {
    title: '序号',
    width: 65,
    dataIndex: 'index'
  },
  {
    title: '阶段/类别',
    dataIndex: 'name'
  },
  {
    title: '业务事项',
    dataIndex: 'businessMatters'
  },
  {
    title: '管控级别',
    dataIndex: 'level'
  },
  {
    title: '周期',
    dataIndex: 'duration'
  },
  {
    title: '计划开始时间',
    dataIndex: 'startTime'
  },
  {
    title: '计划结束时间',
    dataIndex: 'endTime'
  },
  {
    title: '前置任务',
    dataIndex: ''
  },
  {
    title: '间隔时间',
    dataIndex: ''
  },
  {
    title: '完成标准',
    dataIndex: 'completeStandard'
  },
  {
    title: '验证资料',
    dataIndex: 'verifyDoc'
  },
  {
    title: '第一责任人',
    dataIndex: 'firstResponsible'
  },
  {
    title: '直接责任人',
    dataIndex: 'responsible'
  }
]
export default {
  name: 'a' + Date.now(),
  components: {
    ARow
  },
  props: {
    // 是否作为审批详情
    isAudit: {
      type: Boolean,
      default: false
    },
    // 是否作为意见征询
    isConsultation: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      columns,
      columnWbs,
      businessId: '',
      reqMethod: 'post',

      listUrl: '/cscec-project-business/project/suspended/management/stoppage-fileQuery',
      listUrls: '/cscec-project-business/project/suspended/management/resume-fileQuery',
      uploadList: '',

      visible: false,

      data: [],
      dataStarts: [], // 重新开工附件

      dels: {
        viewName: ''
      }, // 获取分包商管理基本信息对象
      totalDels: {},
      queryParams: {},

      token: '',
      type: '',
      uploadArrys0: [],
      uploadArrys1: []
    }
  },

  created() {
    this.id = this.$route.query.id.replace('_resume', '')
    this.businessId = this.$route.query.id.replace('_resume', '')
    this.type = this.$route.query.type
    this.getQuarterAssessmentOne()
    this.token = Vue.getAcloudProvider().getAccessToken()
  },
  computed: {},
  methods: {
    goBack() {
      // this.$router.push({path:'/stop-construction/list'})
      if (this.type == 'approve') {
        window.close()
      } else {
        this.$multiTab.close(this.$route.fullpath)
      }
    },
    associateDetails() {
      this.visible = true
    },

    handCancel() {
      this.visible = false
    },
    getQuarterAssessmentOne() {
      workStoppageApplyDetail(this.id).then(res => {
        this.dels = { ...res.data, _stoppageTypeText: res.data.stoppageType === 'STOP' ? '停工' : '停缓建' }
        if (this.dels.ifDongChang === true) {
          this.dels.ifDongChang = '是'
        }
        if (this.dels.ifDongChang === false) {
          this.dels.ifDongChang = '否'
        }
        this.dels.viewName = this.dels.branchComName + '/' + this.dels.projectName
        this.uploadArrys0 = res.data.fileList
        this.uploadArrys1 = res.data.resumeWorkApply?.fileList
      })
    }
  }
}
</script>
